<template>
  <div class="ccc">
    <div class="rating">
      <div class="top">
        <div class="left">
          <p>{{ sellerIofo.name }}</p>
          <p>
            <img src="../../../img/star36_on@2x.png" alt="" />

            <img src="../../../img/star36_on@2x.png" alt="" />
            <img src="../../../img/star36_on@2x.png" alt="" />
            <img src="../../../img/star36_on@2x.png" alt="" />
            <img src="../../../img/star36_off@2x.png" alt="" />
            <span>({{ sellerIofo.rankRate }})</span>
            <span>月售{{ sellerIofo.sellCount }}单</span>
          </p>
        </div>
        <div class="rig">
          <img src="../../../img/star48_on@2x.png" alt="" />
          <p>收藏</p>
        </div>
      </div>
      <div class="bot">
        <div class="ddd">
          <p class="p1">起送价</p>
          <p class="p2">
            <span>{{ sellerIofo.minPrice }}</span
            >元
          </p>
        </div>
        <div class="ddd">
          <p class="p1">商家配送</p>
          <p class="p2">
            <span>{{ sellerIofo.deliveryPrice }}</span
            >元
          </p>
        </div>
        <div class="ddd">
          <p class="p1">平均配送时间</p>
          <p class="p2">
            <span>{{ sellerIofo.deliveryTime }}</span
            >分钟
          </p>
        </div>
      </div>
    </div>

    <div class="active">
      <div>
        <p class="p1">公告与活动</p>
        <p class="p2">
          {{ sellerIofo.bulletin }}
        </p>
      </div>
      <p class="pppp1">
        <img src="../../../img/decrease_2@2x.png" alt="" />
        {{ sellerIofo.supports[0].description }}
      </p>
      <p class="pppp1">
        <img src="../../../img/discount_2@2x.png" alt="" />
        {{ sellerIofo.supports[1].description }}
      </p>
      <p class="pppp1">
        <img src="../../../img/discount_2@2x.png" alt="" />
        清肺雪梨汤8折抢购
      </p>
      <p class="pppp1">
        <img src="../../../img/special_2@2x.png" alt="" />
        特价饮品八折抢购
      </p>

      <p class="pppp1">
        <img src="../../../img/special_2@2x.png" alt="" />
        {{ sellerIofo.supports[2].description }}
      </p>
      <p class="pppp1">
        <img src="../../../img/invoice_2@2x.png" alt="" />
        {{ sellerIofo.supports[3].description }}
      </p>
      <p class="pppp1">
        <img src="../../../img/invoice_2@2x.png" alt="" />
        {{ sellerIofo.supports[4].description }}
      </p>
    </div>

    <div class="img11">
      <p>商家实景</p>
      <div>
        <img :src="sellerIofo.pics[0]" alt="" />
        <img :src="sellerIofo.pics[1]" alt="" />
        <img :src="sellerIofo.pics[2]" alt="" />
      </div>
    </div>

    <div class="shang">
      <p class="ppppp1">商家信息</p>
      <p class="ppppp2">{{ sellerIofo.infos[0] }}</p>
      <p class="ppppp2">{{ sellerIofo.infos[1] }}</p>
      <p class="ppppp2">{{ sellerIofo.infos[2] }}</p>
      <p class="ppppp2">{{ sellerIofo.infos[3] }}</p>
    </div>
    <!-- 底部购物车 -->
    <div class="shopCar">
      <p class="p1">
        <img :src="imgsrc" alt="" class="iff" @click="showCar" />
        ￥{{ getPrice }}
      </p>
      <p class="p2">另需配送费￥4元</p>
      <p class="p3">￥20起送</p>
    </div>
  </div>
</template>

<script>
import { mapActions, mapMutations, mapState } from "vuex";
export default {
  data() {
    return {};
  },
  created() {
    //获取头部数据
    this.getSeller();
  },
  computed: {
    ...mapState(["sellerIofo"]),
    ...mapState(["goods", "price", "carList", "show", "img", "imgsrc"]),
    // 计算总价
    getPrice() {
      let num = 0;
      // 循环遍历购物车中的商品价格乘数量
      this.carList.forEach((item) => {
        num += item.price * item.count;
      });
      return num;
    },
  },
  methods: {
    ...mapActions(["getSeller"]),
    ...mapMutations(["qing"]),

    // 展示购物车列表
    showCar() {
      this.$store.commit("showCar");
    },
  },
};
</script>

<style lang="less" scoped>
.ccc {
  background-color: #f3f5f7;
  height: 70vh;
  overflow: scroll;
}

.rating {
  padding: 18px;
  border-bottom: 1px solid rgba(7, 17, 27, 0.1);
  background-color: #fff;

  .top {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(7, 17, 27, 0.1);
    padding-bottom: 18px;

    .left {
      font-size: 14px;
      color: rgba(7, 17, 27);
      line-height: 14px;

      p {
        padding-top: 8px;

        img {
          width: 20px;
          margin-right: 4px;
        }

        span {
          font-size: 10px;
          color: rgb(77, 85, 93);
          line-height: 18px;
          margin-right: 8px;
        }
      }
    }

    .rig {
      p {
        padding-top: 4px;
        color: rgb(77, 85, 93);
      }
    }
  }

  .bot {
    display: flex;
    text-align: center;
    padding-top: 18px;

    .ddd {
      width: 33%;

      .p1 {
        font-size: 10px;
        color: rgb(147, 153, 159);
      }

      .p2 {
        font-size: 14px;
        font-weight: 200;
        line-height: 14px;
        padding-top: 4px;

        span {
          font-size: 24px;
        }
      }
    }

    .ddd:nth-child(2) {
      border-left: 1px solid rgba(7, 17, 27, 0.1);
      border-right: 1px solid rgba(7, 17, 27, 0.1);
    }
  }
}

.active {
  background-color: #fff;
  // margin: 18px 0px;
  padding: 18px;
  padding-bottom: 0px;

  border-bottom: 1px solid rgba(7, 17, 27, 0.1);
  div {
    .p1 {
      font-size: 24px;
      font-weight: 200;
      color: rgba(7, 17, 27);
    }

    .p2 {
      font-size: 12px;
      font-weight: 200;
      color: red;
      padding: 8px 12px 18px 12px;
      border-bottom: 1px solid rgba(7, 17, 27, 0.1);
      padding-bottom: 18px;
    }
  }
  .pppp1 {
    padding: 16px 12px 16px 30px;
    border-bottom: 1px solid rgba(7, 17, 27, 0.1);
    font-size: 12px;
    font-weight: 200;
    line-height: 16px;
    position: relative;
    // text-indent: 10px;
    img {
      width: 24px;
      position: absolute;
      top: 14px;
      left: 0px;
    }
  }
  .pppp1:last-child {
    border-bottom: none;
  }
}
.img11 {
  margin-top: 18px;
  padding: 18px;
  background-color: #fff;
  border-top: 1px solid rgba(7, 17, 27, 0.1);
  border-bottom: 1px solid rgba(7, 17, 27, 0.1);
  p {
    font-size: 24px;
    font-weight: 200;
    color: rgba(7, 17, 27);
    margin-bottom: 12px;
  }
  div {
    img {
      width: 104px;
      height: 90px;
    }
    img:nth-child(2) {
      margin: 0px 12px;
    }
  }
}
.shang {
  background-color: #fff;
  margin-top: 18px;
  padding: 18px;
  .ppppp1 {
    font-size: 24px;
    font-weight: 200;
    color: rgba(7, 17, 27);
    padding-bottom: 12px;
  }
  .ppppp2 {
    padding: 16px 12px;
    font-size: 12px;
    font-weight: 200;
    color: rgba(7, 17, 27);
    border-top: 1px solid rgba(7, 17, 27, 0.1);
  }
}
.shopCar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  // background: blue;
  // height: 60px;
  z-index: 200;
  color: #fff;
  background-color: #141d27;
  display: flex;

  .p1 {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 700;
    line-height: 24px;
    border-right: 1px solid rgb(255, 255, 255, 0.1);
    margin: 22px 0px;
    padding-left: 70px;
    padding-right: 12px;
    position: relative;

    .iff {
      position: absolute;
      width: 60px;
      bottom: 10px;
      left: 5px;
    }
  }

  .p2,
  .p3 {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.4);
    // font-weight: 700;
    line-height: 24px;
    padding: 22px 0px;
  }

  .p2 {
    padding-left: 12px;
    flex: 1;
  }

  .p3 {
    text-align: center;
    background-color: rgba(255, 255, 255, 0.4);
    width: 105px;
  }
}
</style>
